home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / datumtarg.cls < prev    next >
Encoding:
Visual Basic class definition  |  2004-03-05  |  19.2 KB  |  567 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "Target"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = True
  14.  
  15. Option Explicit
  16. '/******************************************************************/
  17. '/*                                                                */
  18. '/*                      TurboCAD for Windows                      */
  19. '/*                   Copyright (c) 1993 - 2001                    */
  20. '/*             International Microcomputer Software, Inc.         */
  21. '/*                            (IMSI)                              */
  22. '/*                      All rights reserved.                      */
  23. '/*                                                                */
  24. '/******************************************************************/
  25.  
  26. 'DBAPI constants
  27. Const gkGraphic = 11
  28. Const gkArc = 2
  29. Const gkText = 6
  30. Const gfCosmetic = 128&
  31.  
  32. 'Useful math constants
  33. Const Pi# = 3.14159265
  34.  
  35. 'Real variant types!
  36. Const typeEmpty = 0
  37. Const typeInteger = 2
  38. Const typeLong = 3
  39. Const typeSingle = 4
  40. Const typeDouble = 5
  41. Const typeCurrency = 6
  42. Const typeDate = 7
  43. Const typeString = 8
  44. Const typeObject = 9
  45. Const typeBoolean = 11
  46. Const typeVariant = 12
  47. Const typeIntegerEnum = typeInteger + 100
  48. Const typeLongEnum = typeLong + 100
  49. Const typeStringEnum = typeString + 100
  50.  
  51. 'Stock property pages
  52. Const ppStockPen = 1
  53. Const ppStockBrush = 2
  54. Const ppStockText = 4
  55. Const ppStockInsert = 8
  56. Const ppStockViewport = 16
  57. Const ppStockAuto = 32
  58.  
  59. 'Property Ids
  60. Const idDiam = 1
  61. Const idText1 = 2
  62. Const idText2 = 3
  63. Const idText3 = 4
  64. Const idSymbolSize = 5
  65. Const idFontSize = 6
  66.  
  67.  
  68. 'Property enums
  69.  
  70. 'Number of properties, pages, wizards
  71. Const NUM_PROPERTIES = 6
  72. Const NUM_PAGES = 1
  73. Const NUM_WIZARDS = 0
  74. Const formCaption = "Datum Target Symbol"
  75. Private Sub Class_Initialize()
  76.     'Initialize class variables
  77. End Sub
  78.  
  79. 'Returns the user-visible description of this RegenMethod
  80. Public Property Get Description() As String
  81.     Description = "SDK_DatumTarget"
  82. End Property
  83.  
  84. 'Returns the persistent class id for this RegenMethod's property section
  85. Public Property Get ClassID() As String
  86.     ClassID = "{FDB6F1CA-9631-11d1-A40A-0000B465872B}"
  87. End Property
  88.  
  89. 'Retrieve types and names
  90. Public Function GetPropertyInfo(Names As Variant, Types As Variant, _
  91.     IDs As Variant, Defaults As Variant) As Long
  92.     ReDim Names(NUM_PROPERTIES), Types(NUM_PROPERTIES), _
  93.         IDs(NUM_PROPERTIES), Defaults(NUM_PROPERTIES)
  94.     
  95.     Names(0) = "Diam"
  96.     Types(0) = typeInteger
  97.     IDs(0) = idDiam
  98.     Defaults(0) = 1
  99.     
  100.     Names(1) = "TagAreaSize"
  101.     Types(1) = typeString
  102.     IDs(1) = idText1
  103.     Defaults(1) = "1"
  104.         
  105.     Names(2) = "DatumLetter"
  106.     Types(2) = typeString
  107.     IDs(2) = idText2
  108.     Defaults(2) = "A"
  109.     
  110.     Names(3) = "TargetNumber"
  111.     Types(3) = typeString
  112.     IDs(3) = idText3
  113.     Defaults(3) = "1"
  114.     
  115.     Names(4) = "SymbolSize"
  116.     Types(4) = typeDouble
  117.     IDs(4) = idSymbolSize
  118.     Defaults(4) = 0.5
  119.     
  120.     Names(5) = "FontSize"
  121.     Types(5) = typeDouble
  122.     IDs(5) = idFontSize
  123.     Defaults(5) = 0.25
  124.     
  125.     
  126.         
  127. 'End Scale
  128.     GetPropertyInfo = NUM_PROPERTIES
  129. End Function
  130.  
  131. 'Get the number of property pages supporting this RegenMethod
  132. Public Function GetPageInfo(ByVal AGraphic As Object, StockPages As Long, _
  133.     Names As Variant) As Long
  134.     ReDim Names(NUM_PAGES)
  135.  
  136.     'Need the form
  137. ''    Load frmSample
  138. ''    Names(0) = frmSample.Caption
  139. ''    Unload frmSample
  140.     Names(0) = formCaption
  141.     StockPages = ppStockBrush + ppStockPen + ppStockAuto
  142.     GetPageInfo = NUM_PAGES
  143. End Function
  144.  
  145. Public Function GetWizardInfo(Names As Variant) As Long
  146.     ReDim Names(NUM_WIZARDS)
  147.     GetWizardInfo = NUM_WIZARDS
  148. End Function
  149.  
  150. 'Enumerate the names and values of a specified property
  151. Public Function GetEnumNames(ByVal PropID As Long, Names As Variant, Values As Variant) As Long
  152.     GetEnumNames = 0
  153. End Function
  154.  
  155. Public Function PageControls(ByVal ThisRegenMethod As Object, ByVal Graphic As Object, ByVal PageNumber As Long, ByVal SaveProperties As Boolean) As Boolean
  156.         'Set up error function
  157.         On Error GoTo Failed
  158. Dim Str1$, Str2$, Str3$, SymbolSize#, FontSize#
  159. Dim FontHeight As Double
  160.         If SaveProperties Then
  161.             'OK button on property page was clicked
  162.             'Form is still loaded
  163.             With frmSample
  164.                'Need On Error statement for the case where you have
  165.                 'RRect Turbo Shape and ahother "shape" selected
  166.                 On Error Resume Next
  167.                 
  168.                 Graphic.Properties("Diam") = ImDiam
  169.                 Str1 = .Text1.Text
  170.                 Graphic.Properties("TagAreaSize") = Str1
  171.                 
  172.                 Str2 = .Text2.Text
  173.                 Graphic.Properties("DatumLetter") = Str2
  174.                 
  175.                 Str3 = .Text3.Text
  176.                 Graphic.Properties("TargetNumber") = Str3
  177.                 
  178.                 SymbolSize = CDbl(.Text4.Text)
  179.                 Graphic.Properties("SymbolSize") = SymbolSize
  180.                 
  181.                 FontSize = CDbl(.Text5.Text)
  182.                 Graphic.Properties("FontSize") = FontSize
  183.             
  184.             
  185.             End With
  186.  
  187.         Else
  188.             'Property page is about to be opened
  189.             'Make sure the form is loaded
  190.             Load frmSample
  191.             With frmSample
  192.                 'If more than one Rough-symbol is selected and they do not
  193.                 'have the same properties, don't set up this field
  194.                 On Error GoTo NoRType
  195.                 ImDiam = Graphic.Properties("Diam")
  196.                 
  197.                 Str1 = Graphic.Properties("TagAreaSize")
  198.                 .Text1.Text = Str1
  199.                 
  200.                 Str2 = Graphic.Properties("DatumLetter")
  201.                 .Text2.Text = Str2
  202.                 
  203.                 Str3 = Graphic.Properties("TargetNumber")
  204.                 .Text3.Text = Str3
  205.                 
  206.                 SymbolSize = Graphic.Properties("SymbolSize")
  207.                 .Text4.Text = CStr(SymbolSize)
  208.                 
  209.                 FontSize = Graphic.Properties("FontSize")
  210.                 .Text5.Text = CStr(FontSize)
  211. NoRType:
  212.             End With
  213.         
  214.         End If
  215.  
  216.         PageControls = True
  217.         Exit Function
  218.  
  219. Failed:
  220.         'For debugging purposes, report that an error occurred
  221.         If Err.Number <> 0 Then
  222.             MsgBox "Error in PageControls: " & Err.Description
  223.         End If
  224.  
  225.         'Return false if an error occurred
  226.         PageControls = False
  227. End Function
  228.  
  229. Public Function PageDone(ByVal ThisRegenMethod As Object, Optional PageNumber As Variant)
  230.         'Done with form
  231.         Unload frmSample
  232. End Function
  233.  
  234. Public Function PropertyPages(ByVal ThisRegenMethod As Object, Optional PageNumber As Variant) As Boolean
  235.     With frmSample
  236.         .Show vbModal
  237.         PropertyPages = Not .DialogCanceled
  238.     End With
  239. End Function
  240.  
  241. Public Function Wizard(ByVal ThisRegenMethod As Object, Optional WizardNumber As Variant) As Boolean
  242.     Wizard = False
  243. End Function
  244.  
  245. 'Called when vertex has been moved, or other geometry change
  246. Public Function OnGeometryChanged(ByVal Graphic As Object, ByVal GeomID As Long, paramOld As Variant, paramNew As Variant)
  247.     'Do nothing
  248.     'Regen Graphic
  249. End Function
  250.  
  251. 'Called when vertex is moved, or other geometry change
  252. Public Function OnGeometryChanging(ByVal Graphic As Object, ByVal GeomID As Long, paramOld As Variant, paramNew As Variant) As Boolean
  253.     'OK to continue with change
  254.     OnGeometryChanging = True
  255. End Function
  256.  
  257. Public Function OnNewGraphic(ByVal grfThis As Object, ByVal boolCopy As Boolean) As Boolean
  258.     If boolCopy Then
  259.         'Vertices are already added for us...
  260.         OnNewGraphic = True
  261.         Exit Function
  262.     End If
  263.     On Error GoTo Failed
  264.     ImDiam = 1
  265.     'New Graphic being created
  266.     'X, Y, Z, PenDown, Selectable, Snappable, Editable, Linkable
  267.     'First Vertex is "Center" vertex
  268.     grfThis.Vertices.Add 0#, 0#, 0#, False, True, True, False, True
  269.     'Second Vertex is additional
  270.     grfThis.Vertices.Add 1, 0#, 0#, False, True, True, False, True
  271.     'Third Vertex is additional
  272.     grfThis.Vertices.Add 0, 0, 0#, False, True, True, True, True
  273.     'Forth Vertex is additional
  274.     grfThis.Vertices.Add 0, 0, 0#, False, True, True, True, True
  275.     
  276.     
  277.     grfThis.Properties("LimitVertices") = 4
  278.     OnNewGraphic = True
  279.     Exit Function
  280.  
  281. Failed:
  282.     'Return false on failure
  283.     OnNewGraphic = False
  284. End Function
  285.  
  286. 'Function called whenever a copy of a graphic is being made
  287. Public Function OnCopyGraphic(ByVal grfCopy As Object, ByVal grfSource As Object) As Boolean
  288.     'Return false on failure
  289.     OnCopyGraphic = True
  290. End Function
  291.  
  292. 'Notification function called after graphic property is saved
  293. Public Function OnPropertyChanged(ByVal Graphic As Object, ByVal PropID As Long, _
  294.         ValueOld As Variant, ValueNew As Variant)
  295.     'Do nothing
  296. End Function
  297.  
  298. 'Notification function called when graphic property is saved
  299. Public Function OnPropertyChanging(ByVal Graphic As Object, ByVal PropID As Long, _
  300.         ValueOld As Variant, ValueNew As Variant) As Boolean
  301.     'OK to proceed
  302.     OnPropertyChanging = True
  303. End Function
  304.  
  305. 'Notification function called when graphic property is retrieved
  306. Public Function OnPropertyGet(ByVal Graphic As Object, ByVal PropID As Long)
  307.     'Do nothing
  308. End Function
  309.  
  310. 'Called when we need to update our object
  311. Public Function Regen(ByVal grfThis1 As Object)
  312.         'Setup error handler
  313.         On Error GoTo Failed
  314. Dim grfThis As Graphic
  315.         Set grfThis = grfThis1
  316.         grfThis.Properties("PenStyle") = "CONTINUOUS"
  317.         'Set up lock (prevent recursion)
  318.         Dim LockCount&
  319.         LockCount& = grfThis.RegenLock
  320.  
  321.         'Setup error handler (make sure lock is removed)
  322.         On Error GoTo FailedLock
  323.         If LockCount& = 0 Then
  324.             'Delete any previous cosmetic children
  325.             grfThis.Graphics.Clear gfCosmetic
  326.  
  327.             
  328.  
  329. Dim Diam%, Str1$, Str2$, Str3$, d#, FontSize#
  330. Dim Gr As Graphic
  331.             
  332.             Diam = grfThis.Properties("Diam")
  333.             Str1 = grfThis.Properties("TagAreaSize")
  334.             Str2 = grfThis.Properties("DatumLetter")
  335.             Str3 = grfThis.Properties("TargetNumber")
  336.             d = grfThis.Properties("SymbolSize")
  337.             FontSize = grfThis.Properties("FontSize")
  338.  
  339.             'Add child Graphics
  340. Dim Salp#, Calp#, L#
  341. Dim X0#, Y0#, X1#, Y1#
  342.             With grfThis.Vertices
  343.                 X0 = .Item(0).X
  344.                 Y0 = .Item(0).Y
  345.                 X1 = .Item(1).X
  346.                 Y1 = .Item(1).Y
  347.                 L = Sqr((X1 - X0) * (X1 - X0) + (Y1 - Y0) * (Y1 - Y0))
  348.                 Salp = (Y1 - Y0) / L
  349.                 Calp = (X1 - X0) / L
  350.             End With
  351. Dim alp#
  352.             If Calp = 0# Then
  353.                If Salp > 0 Then
  354.                    alp = Pi / 2#
  355.                    GoTo LL
  356.                End If
  357.                If Salp < 0 Then
  358.                    alp = 3# * Pi / 2#
  359.                    GoTo LL
  360.                End If
  361.             End If
  362.             
  363.             If Salp >= 0# And Calp > 0# Then
  364.                alp = Atn(Abs(Salp / Calp))
  365.             End If
  366.             If Salp >= 0# And Calp < 0# Then
  367.                alp = Pi - Atn(Abs(Salp / Calp))
  368.             End If
  369.             If Salp <= 0# And Calp < 0# Then
  370.                alp = Pi + Atn(Abs(Salp / Calp))
  371.             End If
  372.             If Salp <= 0# And Calp > 0# Then
  373.                alp = 2# * Pi - Atn(Abs(Salp / Calp))
  374.             End If
  375. LL:
  376.             If alp > 6.28 Then alp = 0#
  377.             If alp < 0.01 Then alp = 0#
  378.        
  379.             Salp = Sin(alp)
  380.             Calp = Cos(alp)
  381.             X1 = X0 + d / 2 * Cos(alp)
  382.             Y1 = Y0 + d / 2 * Sin(alp)
  383.             grfThis.Vertices(1).X = X1
  384.             grfThis.Vertices(1).Y = Y1
  385.         
  386.      ' Add Cosmetic
  387.         Set Gr = grfThis.Graphics.AddCircleCenterAndPoint(0, 0, 0, 0 + d / 2, 0, 0)
  388.             Gr.Cosmetic = True
  389.             Gr.RotateAxis alp, 0, 0, 1, 0, 0, 0
  390.             Gr.MoveRelative X0, Y0, 0
  391.         Set Gr = grfThis.Graphics.AddLineSingle(-d / 2, 0, 0, 0 + d / 2, 0, 0)
  392.             Gr.Cosmetic = True
  393.             Gr.RotateAxis alp, 0, 0, 1, 0, 0, 0
  394.             Gr.MoveRelative X0, Y0, 0
  395. Dim GrGroup As Graphic
  396. Dim Gr1 As Graphic, Gr2 As Graphic
  397. Dim BBox As BoundingBox
  398. Dim xmax1#, ymax1#, xmin1#, ymin1#
  399. Dim xmax2#, ymax2#, xmin2#, ymin2#
  400. Dim xc#, yc#
  401. Dim x2#, y2#, x3#, y3#
  402. Dim xx0#, yy0#, xx1#, yy1#, xx2#, yy2#
  403.         With grfThis.Vertices
  404.             x2 = .Item(2).X
  405.             y2 = .Item(2).Y
  406.             x3 = .Item(3).X
  407.             y3 = .Item(3).Y
  408.         End With
  409.         'Diameter an top
  410.         
  411.         
  412. Dim hSym#
  413.         hSym = FontSize
  414.         
  415.         If Diam > 0 Or Str1 <> "" Then
  416.             Set GrGroup = grfThis.Graphics.Add(11)
  417.             GrGroup.Cosmetic = True
  418.             xmax1 = 0
  419.             If Diam > 0 Then
  420.                 Set Gr1 = GrGroup.Graphics.AddText(Chr(110), 0, 0.7 * hSym, 0, 0.7 * hSym)
  421.                     Gr1.Cosmetic = True
  422.                 Gr1.Properties("TextFont") = "gdt.shx"
  423.                 Gr1.Properties("TextStyle") = 0
  424.                     
  425.                 xmax1 = Gr1.CalcBoundingBox.Max.X
  426.                 xmin1 = Gr1.CalcBoundingBox.Min.X
  427.             End If
  428.             xmax2 = xmax1
  429.             If Str1 <> "" Then
  430.                 Set Gr2 = GrGroup.Graphics.AddText(Str1, xmax1, hSym, 0, hSym)
  431.                     Gr2.Cosmetic = True
  432.                 xmax2 = Gr2.CalcBoundingBox.Max.X
  433.                 xmin2 = Gr2.CalcBoundingBox.Min.X
  434.             End If
  435.             If Sqr((x2 - X0) * (x2 - X0) + (y2 - Y0) * (y2 - Y0)) < 0.6 * d Then
  436.                 GrGroup.MoveRelative -(xmax2 - xmin1) / 2, 0, 0
  437.                 GrGroup.RotateAxis alp, 0, 0, 1, 0, 0, 0
  438.                 GrGroup.MoveRelative X0, Y0, 0
  439.                 grfThis.Vertices(2).X = X0 + d / 4 * Cos(alp + Pi / 2)
  440.                 grfThis.Vertices(2).Y = Y0 + d / 4 * Sin(alp + Pi / 2)
  441.             Else
  442.                 xmax1 = GrGroup.CalcBoundingBox.Max.X
  443.                 ymax1 = GrGroup.CalcBoundingBox.Max.Y
  444.                 xmin1 = GrGroup.CalcBoundingBox.Min.X
  445.                 ymin1 = GrGroup.CalcBoundingBox.Min.Y
  446.                 xc = (xmax1 + xmin1) / 2
  447.                 yc = (ymax1 + ymin1) / 2
  448.                 GrGroup.MoveRelative x2 - xc, y2 - yc, 0
  449.                 Set Gr = grfThis.Graphics.Add(11)
  450.                     Gr.Cosmetic = True
  451.                 If x2 > X0 Then
  452.                     xx0 = X0 + d / 4 * Cos(alp + Pi / 2)
  453.                     yy0 = Y0 + d / 4 * Sin(alp + Pi / 2)
  454.                     xx1 = x2 - 1.6 * (xmax1 - xmin1) / 2
  455.                     yy1 = y2
  456.                     xx2 = x2 - (xmax1 - xmin1) / 2
  457.                     yy2 = y2
  458.                 Else
  459.                     xx0 = X0 + d / 4 * Cos(alp + Pi / 2)
  460.                     yy0 = Y0 + d / 4 * Sin(alp + Pi / 2)
  461.                     xx1 = x2 + 1.6 * (xmax1 - xmin1) / 2
  462.                     yy1 = y2
  463.                     xx2 = x2 + (xmax1 - xmin1) / 2
  464.                     yy2 = y2
  465.                 End If
  466.                 With Gr.Vertices
  467.                     .Add xx0, yy0, 0
  468.                     .Add xx1, yy1, 0
  469.                     .Add xx2, yy2, 0
  470.                 End With
  471.                 
  472.                 Set Gr = grfThis.Graphics.AddCircleCenterAndPoint(xx0, yy0, 0, xx0 + d / 20, yy0, 0)
  473.                     Gr.Cosmetic = True
  474.                     Gr.Properties("BrushStyle") = "Solid"
  475.             End If
  476.         End If
  477.             
  478.     'Bottom
  479. Dim Gr3 As Graphic, Gr4 As Graphic
  480.         If Str2 <> "" Or Str3 <> "" Then
  481.             Set GrGroup = grfThis.Graphics.Add(11)
  482.             GrGroup.Cosmetic = True
  483.             xmax1 = 0
  484.             If Str2 <> "" Then
  485.                 Set Gr3 = GrGroup.Graphics.AddText(Str2, 0, 0.15 * hSym, 0, hSym)
  486.                     Gr3.Cosmetic = True
  487.                 xmax1 = Gr3.CalcBoundingBox.Max.X
  488.                 ymax1 = Gr3.CalcBoundingBox.Max.Y
  489.                 xmin1 = Gr3.CalcBoundingBox.Min.X
  490.                 ymin1 = Gr3.CalcBoundingBox.Min.Y
  491.             End If
  492.             xmax2 = xmax1
  493.             If Str3 <> "" Then
  494.                 Set Gr4 = GrGroup.Graphics.AddText(Str3, xmax1, 0.15 * hSym, 0, hSym)
  495.                     Gr4.Cosmetic = True
  496.                 xmax2 = Gr4.CalcBoundingBox.Max.X
  497.                 ymax2 = Gr4.CalcBoundingBox.Max.Y
  498.                 xmin2 = Gr4.CalcBoundingBox.Min.X
  499.                 ymin2 = Gr4.CalcBoundingBox.Min.Y
  500.             End If
  501.             If Sqr((x3 - X0) * (x3 - X0) + (y3 - Y0) * (y3 - Y0)) < 0.6 * d Then
  502.                 GrGroup.MoveRelative -(xmax2 - xmin1) / 2, 0, 0
  503.                 GrGroup.RotateAxis alp, 0, 0, 1, 0, 0, 0
  504.                 GrGroup.MoveRelative X0, Y0, 0
  505.                 grfThis.Vertices(3).X = X0 + d / 4 * Cos(alp + 3 * Pi / 2)
  506.                 grfThis.Vertices(3).Y = Y0 + d / 4 * Sin(alp + 3 * Pi / 2)
  507.             Else
  508.                 xmax1 = GrGroup.CalcBoundingBox.Max.X
  509.                 ymax1 = GrGroup.CalcBoundingBox.Max.Y
  510.                 xmin1 = GrGroup.CalcBoundingBox.Min.X
  511.                 ymin1 = GrGroup.CalcBoundingBox.Min.Y
  512.                 xc = (xmax1 + xmin1) / 2
  513.                 yc = (ymax1 + ymin1) / 2
  514.                 GrGroup.MoveRelative x3 - xc, y3 - yc, 0
  515.                 Set Gr = grfThis.Graphics.Add(11)
  516.                     Gr.Cosmetic = True
  517.                 If x3 > X0 Then
  518.                     xx0 = X0 + d / 4 * Cos(alp + 3 * Pi / 2)
  519.                     yy0 = Y0 + d / 4 * Sin(alp + 3 * Pi / 2)
  520.                     xx1 = x3 - 1.6 * (xmax1 - xmin1) / 2
  521.                     yy1 = y3
  522.                     xx2 = x3 - (xmax1 - xmin1) / 2
  523.                     yy2 = y3
  524.                 Else
  525.                     xx0 = X0 + d / 4 * Cos(alp + 3 * Pi / 2)
  526.                     yy0 = Y0 + d / 4 * Sin(alp + 3 * Pi / 2)
  527.                     xx1 = x3 + 1.6 * (xmax1 - xmin1) / 2
  528.                     yy1 = y3
  529.                     xx2 = x3 + (xmax1 - xmin1) / 2
  530.                     yy2 = y3
  531.                 End If
  532.                 With Gr.Vertices
  533.                     .Add xx0, yy0, 0
  534.                     .Add xx1, yy1, 0
  535.                     .Add xx2, yy2, 0
  536.                 End With
  537.                 
  538.                 Set Gr = grfThis.Graphics.AddCircleCenterAndPoint(xx0, yy0, 0, xx0 + d / 20, yy0, 0)
  539.                     Gr.Cosmetic = True
  540.                     Gr.Properties("BrushStyle") = "Solid"
  541.             End If
  542.             
  543.         End If
  544.         
  545.     End If
  546.         
  547.     grfThis.RegenUnlock
  548.  
  549.     Exit Function
  550.  
  551. FailedLock:
  552.         'Remove lock
  553.         grfThis.RegenUnlock
  554. Failed:
  555.         If Err.Number <> 0 Then
  556.             MsgBox "Regen error: " & Err.Description
  557.         End If
  558. End Function
  559.  
  560. Public Function Draw(ByVal grfThis As Object, ByVal view As Object, Optional mat As Variant) As Boolean
  561.     'Return True if we did the redraw (no further processing necessary, no children will be drawn).
  562.     'Since this is just a test, we return False to let TurboCAD do the drawing operation.
  563.     Draw = False
  564. End Function
  565.  
  566.  
  567.